﻿<div id="modelsBuilder" ng-controller="Umbraco.Dashboard.ModelsBuilderController">

    <div ng-show="ready" style="float: right;">
        <button type="button" class="btn" ng-click="reload()"><span>Reload</span></button>
    </div>

    <h3>Models Builder</h3>

    <div ng-show="!ready">
        Loading...
    </div>

    <div ng-show="ready">
        <div ng-bind-html-unsafe="dashboard.text"></div>

        <div ng-if="dashboard.outOfDateModels">
            <p>Models are <strong>out-of-date</strong>.
            </p>
        </div>

        <div ng-if="dashboard.canGenerate">
            <div ng-if="dashboard.generateCausesRestart">
                <p style="color: red; font-weight: bold;">Generating models will restart the application.</p>
            </div>
            <div ng-show="!generating">
                <button type="button" ng-click="generate()" class="btn btn-danger">
                    <span>Generate models</span>
                </button>
            </div>
            <div class="umb-loader-wrapper" ng-show="generating">
                <div class="umb-loader"></div>
            </div>
        </div>

        <div ng-if="dashboard.lastError" style="margin-top: 32px;" ng-show="!generating">
            <span style="color: red; font-weight: bold;">Last generation failed with the following error:</span>
            <pre style="width: 80%; white-space: pre-line; background: #f8f8f8; padding: 4px; font-size: small;">{{dashboard.lastError}}</pre>
        </div>
    </div>

</div>
